import fs from 'fs';
import express from 'express';
import { createUserList } from './src/utils/mock.js';
const app = express();
const port = 3000;
app.get('/api/user/list', (req, res) => {
  const { pageSize = 10, pageNo = 1 } = req.query;
  const data = {
    msg: 'success',
    code: 0,
    data: createUserList({ pageSize, pageNo }),
    total: 200
  };
  res.json(data);
});
app.get('/api/menus', (req, res) => {
  fs.readFile('./public/api/menus.json', 'utf8', (err, data) => {
    if (err) {
      console.error(err);
      return;
    }
    res.json(JSON.parse(data));
  });
});
app.listen(port, () => {
  console.log(`Example app listening on port ${port}`);
});
